﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;

namespace ProjectA.Controls
{
    public class cPage : Panel
    {

        public Image ImageBackGroundPage { get; set; }

        public cPage()
        {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
            this.Location = new Point(0, 0);
            this.Size = new System.Drawing.Size(884, 662);
            
        }

        protected override void OnPaint(PaintEventArgs pe)
        {
            if (ImageBackGroundPage != null)
                pe.Graphics.DrawImage(ImageBackGroundPage, 0, 0);

        }

        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
        }

        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x20;
                return cp;
           }
        }/*

        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x20;
                return cp;
            }
        }

        private void TickHandler(object sender, EventArgs e)
        {
            InvalidateEx();
        }

        private void InvalidateEx()
        {
            if (Parent != null)
                Parent.Invalidate(Bounds, false);
            else
                Invalidate();
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            if (ImageBackGroundPage != null)
            {
                e.Graphics.DrawImage(ImageBackGroundPage, 0, 0, ImageBackGroundPage.Width, ImageBackGroundPage.Height);
            }
        }*/
       
    }
}
